package br.com.moxeon.layerinterface;

import java.util.HashMap;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import br.com.moxeon.control.ThrowOperationController;
import br.com.moxeon.control.operation.rules.FinancialRule;
import br.com.moxeon.model.enums.TypeThrowOperation;
import br.com.vexillum.util.Return;

@Service(value="iMoxeonInterface")
@Scope("prototype")
public class MoxeonInterfaceImplematation implements IMoxeonInterface {

	
	@Override
	public Return doOperation(TypeThrowOperation operation,
			HashMap<String, Object> parameter) {
		
		FinancialRule rule = MoxeonFactory.getOperationRule(operation, parameter);		
		rule.executeOperation();
		
		ThrowOperationController controller = MoxeonFactory.getOperationController(operation, parameter);
		controller.setEntity(rule.getOperationResult());
		return controller.doAction("save");		
	}


	
	

}
